package tp.pr2;

public class Command
{

	private Directions direction;
	private VerbCommands verb;
	private String id;

	public Command()
	{
		this.verb = VerbCommands.UNKNOWN;
		this.direction = Directions.UNKNOWN;
		this.id=null;
	}

	public Command(VerbCommands verbCommand)
	{
		this.verb = verbCommand;
		this.direction = Directions.UNKNOWN;
		this.id=null;
	}

	public Command(VerbCommands verbCommand, String id)
	{
		this.verb=verbCommand;
		this.id=id;
		this.direction=Directions.UNKNOWN;
	
	}

	public Command(VerbCommands verbCommand, Directions direction)
	{
		this.verb = verbCommand;
		this.direction = direction;
	}

   public boolean isValid(){
    	if (this.verb == VerbCommands.UNKNOWN)
    		return false;
    	
    		if (this.verb == VerbCommands.GO){
    			if (this.direction == Directions.UNKNOWN)
    				return false;
    				return true;
    			}
    		if ((this.verb == VerbCommands.PICK)||(this.verb == VerbCommands.USE)){
    				if((this.id == "")||(this.id==null))
    					return false;
    					return true;
    		  }
    	
		return true;
    }
	public Directions getDirection()
	{
		return this.direction;
	}

	public VerbCommands getVerb()
	{
		return this.verb;
	}

	public void setDirection(Directions direction)
	{
		if (direction == null)
			this.direction = Directions.UNKNOWN;
		else
			this.direction = direction;
	}

    public String getIdItem(){
    	return this.id;
    }


}
